import java.util.ArrayList;

public class ThreadedJob {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>(){{
            add(new Student(1,"张三",18));
            add(new Student(2,"李四",20));
            add(new Student(3,"王五",19));
        }};

        Runnable print1 = new PrintString("你好",50);
        Runnable print2 = new PrintStudent(list);
        Runnable print3 = new PrintString("再见",50);

        Thread thread1 = new Thread(print1);
        Thread thread2 = new Thread(print2);
        Thread thread3 = new Thread(print3);

        thread1.start();
        thread2.start();
        thread3.start();

    }
}

class PrintString implements Runnable {
    private String stringToPrint;
    private int times;

    public PrintString(String s,int t){
        stringToPrint = s;
        times = t;
    }

    public void run(){
        for (int i = 0;i < times;i++){
            System.out.print(stringToPrint);
        }
    }
}

class Student {
    private int id;
    private String name;
    private int age;
    public Student(){

    }
    public Student(int id, String name, int age) {
        this.id = id;
        this.name = name;
        this.age = age;
    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class PrintStudent implements Runnable{
    ArrayList<Student> list = new ArrayList<>();
    public PrintStudent(ArrayList l){
        list = l;
    }

    public void run(){
        for (int i=0;i<list.size();i++){
            Student stu = list.get(i);
            System.out.println("学号："+stu.getId() + " 名字："+stu.getName() + " 年龄："+stu.getAge());
        }
    }
}